#pragma once

#pragma comment(lib,"wiiuse.lib")

#include "wiiuse.h"
#include "mtListener.h"
#include "ConfigFile.h"

class mtScreen
{
public:
	mtScreen(void);
	virtual ~mtScreen(void);

	virtual void addListener(mtListener *listener);

	virtual void fingerDown(TouchData data);
	virtual void fingerUpdate(TouchData data);
	virtual void fingerUp(int id);

	virtual bool connect();
	virtual void start();
	virtual void process();

	virtual bool saveConfig(TouchData p1, TouchData p2, TouchData p3, TouchData p4, std::string file);
	virtual void loadConfig(std::string);

	unsigned int minx, miny, maxx, maxy, sensitivity;
	bool fliph, flipv;
	bool running;

private:
	void fingerTimeout(unsigned int ID);
	static void mtScreen::_processEntryPoint(void * obj);
	mtListener* listener;
	wiimote **wm;
	bool activeFingers[4];
	unsigned int activeFingersTimeout[4];
	unsigned int fingerIDs[4];
	unsigned int FINGERTIMEOUT;
	HANDLE hThread;
};
